{include file="../Public/header.html"}
<script type="text/javascript" src="__PUBLIC__/Js/xheditor-1.1.13/xheditor-1.1.13-zh-cn.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/xheditor-1.1.13/xheditor_plugins/ubb.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.validate.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jQuery.validate.message_cn.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/WdatePicker/skin/WdatePicker.css" />
<script type="text/javascript" src="__PUBLIC__/Js/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/thickbox/thickbox.js"></script>
<link href="__PUBLIC__/Js/thickbox/thickbox.css" rel="stylesheet" type="text/css" />
<div class="handle-btns">
	<div class="link-button"><p><a class="" href="?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}" name="" id="">返回列表</a></p></div>
</div>
<form action="?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}&a={$smarty.const.ACTION_NAME}" method="post" name="form_post" id="form_post" enctype="multipart/form-data">
<table cellspacing="0" cellpadding="4" border="0" class="table-form">
	<tbody>
	<tr>
		<th width="200" class="first">商家：</th>
		<td><input name="m_name" id="m_name" type="text"  size="40" class="textinput requireinput required" value="{$promotion.m_name}" readonly="readonly" /><input name="m_id" id="m_id" type="hidden" value="{$promotion.m_id|default:0}" />&nbsp;<a href="?g={$smarty.const.GROUP_NAME}&m=CouponCodeMall&a=select&is_iframe=1&keepThis=true&TB_iframe=true&height=440&width=750" title="选择商家" class="thickbox">选择商家</a></td>
	</tr>
    <tr>
		<th width="200" class="first">活动名称：</th>
		<td><input name="title" type="text"  size="40" class="textinput requireinput required" value="{$promotion.title}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">活动类型：</th>
		<td><select name="cate_id" class="requireinput required">
			<!--{foreach from=$categorys item=item}-->
			<option value="{$item.id}" {if ($smarty.const.ACTION_NAME eq 'edit') && ($item.id eq $promotion.cate_id)}selected{/if}>{$item.prefix}{$item.name}</option>
			<!--{/foreach}-->
			</select></td>
	</tr>
    <tr>
		<th width="200" class="first">有效期：</th>
		<td><input type="Text" name="expiry" class="Wdate textinput requireinput required"  id="expiry" onFocus="WdatePicker({literal}{{/literal}skin:'ext',dateFmt:'yyyy-MM-dd',isShowToday:false,lang:'zh_cn',readOnly:true{literal}}{/literal})" style="cursor: hand; width:160px;" value="{$promotion.expiry}"></td>
	</tr>
    <tr>
		<th width="200" class="first">活动简介：</th>
		<td><textarea name="description" id="description" cols="" rows="" class="textinput requireinput required" style="height:150px; width:550px;">{$promotion.description}</textarea></td>
	</tr>
    <tr>
		<th width="200" class="first">CPS跳转网址：</th>
		<td><input name="gourl" type="text"  size="40" class="textinput requireinput required" value="{$promotion.gourl}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">LOGO：</th>
		<td><input name="logo" id="logo" type="file"  size="40" class="requireinput" />{if $smarty.const.ACTION_NAME eq 'edit'}<a href="{$promotion.logo|fixed_uploadfile_url}" target="_blank">浏览</a>{/if}</td>
	</tr>
    <tr>
		<th width="200" class="first">排序：</th>
		<td><input name="sort_order" type="text"  size="10" class="textinput requireinput required number" value="{$promotion.sort_order|default:'9999'}" /></td>
	</tr>
    <tr>
		<th width="200" class="first">活动详情：</th>
		<td><textarea name="detail" id="detail" cols="" rows="" class="textinput" style="height:250px; width:550px;">{$promotion.detail}</textarea></td>
	</tr>
	<tr class="act">
		<th class="first">&nbsp;</th>
		<td>
			<input type="submit" value="提交" class="submit_btn">
			<input type="reset" value="重置" class="reset_btn">
		</td>
	</tr>
</tbody></table>
<input name="hash" type="hidden" value="{$hash}" />
<input name="id" type="hidden" value="{$promotion.id|default:'0'}" />
</form>
<script type="text/javascript">
var g = '{$smarty.const.GROUP_NAME}';
var m = '{$smarty.const.MODULE_NAME}';
var a = '{$smarty.const.ACTION_NAME}';
var tb_pathToImage = "__PUBLIC__/Js/thickbox/loadingAnimation.gif";
var upscript_url = '__APP__?g=Public&m=Public&a=upload4xheditor&immediate=1';
var editor = null;
<!--{literal}-->
function pick_mall_handler(mall)
{
	if(mall !== null){
		$('#m_id').val(mall.m_id);
		$('#m_name').val(mall.m_name);
	}
	tb_remove();
}
$(document).ready(function() {
			$("#form_post").validate({
						 submitHandler:function(form){
							 						form.detail.value = $('#detail').val();
						 							form.submit();
						 						}
						 });
			if(a == 'add'){
						$('#logo').rules('add', {
						 		required: true
						});
			}
			tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
			imgLoader = new Image();// preload image
			imgLoader.src = tb_pathToImage;
			var options = {elm:'#detail',tools:'full',upscript_url:upscript_url};
			editor = editorInit(options);
});
<!--{/literal}-->
</script>
{include file="../Public/footer.html"}